home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / PowerMacOberon feb96 / Source / Screen.Mod (.txt) < prev    next >
Encoding:
Oberon Text  |  1995-05-08  |  2.4 KB  |  68 lines  |  [TEXT/.Ob4]

  1. Syntax10.Scn.Fnt
  2. FoldElems
  3. Syntax10.Scn.Fnt
  4. (*---------------------------------------------------------------
  5. The Oberon System is designed to work with two tracks of viewers. This causes the
  6. viewer size to become rather small on 15" monitors. Module Screen provides a
  7. convenient way to switch between a two track and a one track display in which
  8. the viewers are larger.
  9. Screen.OneTrack
  10.     makes the whole screen a single track with the Log viewer on the bottom.
  11. Screen.TwoTracks
  12.     switches back to the familiar Oberon screen with a user track and a system track.
  13. ---------------------------------------------------------------*)
  14. Syntax10i.Scn.Fnt
  15. StampElems
  16. Alloc
  17. 8 May 95
  18. Syntax10b.Scn.Fnt
  19. Documentation
  20. MODULE Screen;    (*HM 
  21. (*Needs Log.Menu.Text!*)
  22. IMPORT Display, Files, Viewers, TextFrames, Oberon, Texts, MenuViewers;
  23. VAR neutralize: Oberon.ControlMsg;
  24.     PROCEDURE HandleLog(F: Display.Frame; VAR M: Display.FrameMsg);
  25.         VAR ch: CHAR; R: Texts.Reader; org: LONGINT;
  26.     BEGIN
  27.         TextFrames.Handle(F, M);
  28.         IF M IS TextFrames.UpdateMsg THEN
  29.             WITH M: TextFrames.UpdateMsg DO
  30.                 IF (M.text = Oberon.Log) & (M.id = TextFrames.insert) THEN
  31.                     WITH F: TextFrames.Frame DO
  32.                         WHILE F.text.len > TextFrames.Pos(F, F.X + F.W, F.Y) DO
  33.                             Texts.OpenReader(R, F.text, F.org);
  34.                             REPEAT Texts.Read(R, ch) UNTIL R.eot OR (ch = 0DX);
  35.                             TextFrames.Show(F, Texts.Pos(R))
  36.                         END
  37.                     END
  38.                 END
  39.             END
  40.         END
  41.     END HandleLog;
  42. PROCEDURE OneTrack*;
  43.     VAR v: MenuViewers.Viewer; v0: Viewers.Viewer; t: Texts.Text; buf: Texts.Buffer; menu: TextFrames.Frame;
  44. BEGIN
  45.     v0 := Viewers.This(0, 0);
  46.     IF v0.W < Display.Width THEN
  47.         Viewers.Broadcast(neutralize);
  48.         Display.ReplConst(Display.black, 0, 0, Display.Width, Display.Height, Display.replace);
  49.         Oberon.OpenTrack(0, Display.Width);
  50.         v := MenuViewers.New(
  51.             TextFrames.NewMenu("System.Log", "^Screen.Menu.Text"),
  52.             TextFrames.NewText(Oberon.Log, 0),
  53.             TextFrames.menuH,
  54.             0, TextFrames.menuH + 50);
  55.         v.dsc.next.handle := HandleLog
  56. END OneTrack;
  57. PROCEDURE TwoTracks*;
  58.     VAR v, v1: Viewers.Viewer;
  59. BEGIN
  60.     v := Viewers.This(0, 0);
  61.     IF v.W = Display.Width THEN
  62.         Viewers.Broadcast(neutralize);
  63.         REPEAT v1 := Viewers.Next(v); Viewers.Close(v); v := v1 UNTIL v.state <= 1
  64. END TwoTracks;
  65. BEGIN
  66.     neutralize.id := Oberon.neutralize
  67. END Screen.OneTrack
  68.